// echarts 提示动画
export const echartsAutoPlay = (option:any, myChart:any) => {
    let seriesIndex = 0 //播放系列索引
    let index = 0; //播放所在下标
    function echartsAutoPlay() {
        myChart.dispatchAction({
            type: 'showTip',
            seriesIndex,
            dataIndex: index
        });
        index++;
        const dataLength = option.series[0].data.length;
        if (index > dataLength) {
            seriesIndex++;
            index = 0;
            const seriesLength = option.series.length - 1;
            if (seriesIndex > seriesLength) {
                seriesIndex = 0
                index = 0;
            }
        }
    }
    window.addEventListener('resize', function () {
        myChart.resize();
    });
    return setInterval(echartsAutoPlay, 2000);
}